<template>
  <div>
      <h2>学生姓名：{{name}}</h2>
      <h2>学生年龄：{{age}}</h2>
      <button @click="sendName">将学生的姓名传给School</button>
  </div>
</template>

<script>
import pubsub from 'pubsub-js'
export default {
    name:'Student',
    data(){
        return{
            name:'张三',
            age:18
        }
    },
    methods: {
        sendName(){
            // this.$bus.$emit('StudentName',this.name)
            pubsub.publish('hello',666)
        }
    }

}
</script>

<style>

</style>